package com.woniuxy.ticket.ticketmovie.configuration;

import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@SuppressWarnings(value = "all") //忽略父类警告
public class MybatisPlusConfiguration {
    //配置分页插件的拦截器
    @Bean
    public PaginationInterceptor paginationInterceptor(){
        PaginationInterceptor interceptor = new PaginationInterceptor();
        //如果用户传入的page大于实际page，返回第一页的数据
//        interceptor.setOverflow(true);
        //设置每一页的最大条数
        interceptor.setLimit(100L);
        //设置数据库的类型
        interceptor.setDbType(DbType.MYSQL);
        return interceptor;
    }
}
